<template>
  <div class="part1News">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="新闻中心" name="first"></el-tab-pane>
      <el-tab-pane label="通知公告" name="second"></el-tab-pane>
    </el-tabs>
    <div class="newBox">
      <newsItem :params="item" class="newsItem" v-for="(item,index) in list" :key="index"></newsItem>
    </div>
  </div>
</template>

<script>
import newsItem from "@/views/Home/module/newsItem";
export default {
  name: "part1News",
  components:{
    newsItem
  },
  data() {
    return {
      activeName: 'first',
      list:[]
    };
  },
  mounted() {
    this.getContentHome()
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
      this.getContentHome()
    },

    getContentHome(){
      let params = {
        col:this.activeName == 'first'?56:57,
        page:0,
        pageSize:3
      }
      this.$api.getContentHome(params).then(res=>{
        this.list = res.data.data
      })
    },
  }
}
</script>

<style scoped lang="less">
.part1News{
  width: 747px;
}
.newsItem{
  border-bottom: 1px solid #e6e6e6;
  &:last-child{
    border-bottom: none;
  }
}
</style>